package com.ddy.test.creditcardmanage.model

import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
import com.ddy.test.creditcardmanage.common.Constant
import java.util.*

@Entity(tableName = Constant.TABLE_NAME_CARD_RECORD)
class CardRecord(
    @PrimaryKey
    @ColumnInfo var id: Long,
    @ColumnInfo var cardId: Long,
    @ColumnInfo var recordType: Int,
    @ColumnInfo var amount: Float
    ){

    companion object {
        fun newCardRecord(
            cardId: Long,
            recordType: Int,
            amount: Float
        ): CardRecord{
            val id = Calendar.getInstance().timeInMillis
            return CardRecord(id, cardId, recordType, amount)
        }
    }
}